import * as THREE from "three";

export default {
  for1l: function (renderer, camera, mesh, scene) {
    const geometry = new THREE.BoxGeometry(100, 100, 100);
    //材质对象Material
    const material = new THREE.MeshLambertMaterial({
      color: 0x00ffff, //设置材质颜色
      transparent: true, //开启透明
      opacity: 0.5, //设置透明度
    });
    for (let i = 0; i < 10; i++) {
      const mesh = new THREE.Mesh(geometry, material); //网格模型对象Mesh
      // 沿着x轴分布
      mesh.position.set(i * 200, 0, 0);
      scene.add(mesh); //网格模型添加到场景中
    }
  },
  for2l: function (renderer, camera, mesh, scene) {
    //创建一个长方体几何对象Geometry
    const geometry = new THREE.BoxGeometry(100, 100, 100);
    //材质对象Material
    const material = new THREE.MeshLambertMaterial({
      color: 0x00ffff, //设置材质颜色
      transparent: true, //开启透明
      opacity: 0.5, //设置透明度
    });
    for (let i = 0; i < 10; i++) {
      for (let j = 0; j < 10; j++) {
        const mesh = new THREE.Mesh(geometry, material); //网格模型对象Mesh
        // 在XOZ平面上分布
        mesh.position.set(i * 200, 0, j * 200);
        scene.add(mesh); //网格模型添加到场景中
      }
    }
  },
  sxj: function (renderer, camera, mesh, scene) {
    // const camera = new THREE.PerspectiveCamera(30, width / height, 1, 3000);
    // camera.position.set(292, 223, 185);
    //在原来相机位置基础上拉远，可以观察到更大的范围
    camera.position.set(800, 800, 800);
    camera.lookAt(0, 0, 0);
  },
  sxj1: function (renderer, camera, mesh, scene) {
    // const camera = new THREE.PerspectiveCamera(30, width / height, 1, 3000);
    // const camera = new THREE.PerspectiveCamera(30, width / height, 1, 8000);
    // camera.position.set(292, 223, 185);
    // 超出视锥体远裁界面的范围的会被剪裁掉，不渲染  可以调整far参数适配
    camera.position.set(2000, 2000, 2000);
    camera.lookAt(0, 0, 0);
  },
};
